package com.zatech.cgnci.project.base.enums;

import java.util.Arrays;
import java.util.Objects;

/**
 * <p>
 * 类 ValueDateTypeEnum 的实现描述：模板数据类型枚举
 * </p>
 *
 * @author za-xiaojingjie
 * @version 2024/12/30 13:54
 * @since 2024/12/30 13:54
 */
public enum ValueDataTypeEnum {
    INSURED_FACTOR_STRING("1", "字符串"),
    INSURED_FACTOR_NUMBER("2", "数值"),
    INSURED_FACTOR_ENUM("3", "枚举"),
    INSURED_FACTOR_ENUM_CODE("4", "枚举-关联码表"),
    INSURED_FACTOR_TIME("5", "日期"),
    INSURED_FACTOR_TEXT("6", "文本"),
    EMAIL("7", "邮箱"),
    MOBILE("8", "手机");

    private String code;
    private String desc;

    ValueDataTypeEnum(String code, String desc) {
        this.code=code;
        this.desc=desc;
    }

    public static ValueDataTypeEnum getByCode(String code) {
        return (ValueDataTypeEnum) Arrays.stream(values()).filter((v) -> {
            return Objects.equals(code, v.getCode());
        }).findAny().orElse((ValueDataTypeEnum) null);
    }

    public String getCode() {
        return this.code;
    }

    public String getDesc() {
        return this.desc;
    }
    
}
